//
//  Public.h
//  OverseasImmigration
//
//  Created by yuqin on 2019/5/20.
//  Copyright © 2019年 yuqin. All rights reserved.
//

#ifndef Public_h
#define Public_h

//#define BaseHttpUrl @"http://www.qishuai.xyz:8039/"
#define BaseHttpUrl @"http://65.49.134.4:8039/"

#define DEFINE_SINGLETON_FOR_HEADER(className) \
\
+ (className *)shared##className;

#define DEFINE_SINGLETON_FOR_CLASS(className) \
\
+ (className *)shared##className { \
static className *shared##className = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
shared##className = [[self alloc] init]; \
}); \
return shared##className; \
}

#define weakify(var) \
try {} @catch (...) {} \
__weak __typeof__(var) var ## _weak = var

#define strongify(var) \
try {} @catch (...) {} \
__strong __typeof__(var) var = var ## _weak

#define push_push(UIViewController) UIViewController *ctl = [[UIViewController alloc] init];\
[ctl setHidesBottomBarWhenPushed:YES];\
[self.navigationController pushViewController:ctl animated:YES]\


#define isStringNull(x)       (!x || [x isKindOfClass:[NSNull class]]||x.length == 0||x == nil)
#define isEmptyString(x)      (isStringNull(x) || [x isEqual:@""] || [x isEqual:@"(null)"] || [x isEqual:@"[null]"] || [x isEqual:@"null"] || [x isEqual:@"<null>"])
#define isEmptyObject(object)  [NSObject isNullOrNilWithObject:object]

#define YQ_PUSH(vc) [self.navigationController pushViewController:vc animated:YES]
#define YQ_IMAGE(a) [UIImage imageNamed:a]

#define UIScreenWidth CGRectGetWidth([[UIScreen mainScreen] bounds])
#define UIScreenHeight CGRectGetHeight([[UIScreen mainScreen] bounds])
#define PERCENTW_ADAPTATION  UIScreenWidth/414.0f
#define FIT(f)  f*PERCENTW_ADAPTATION
#define FIT2(f)  (f/2)*PERCENTW_ADAPTATION
#define FIT3(f)  (f/3)*PERCENTW_ADAPTATION

#define YQ_EmptyView(tableView) tableView.emptyDataSetDelegate = self;\
    tableView.emptyDataSetSource = self\

#define YQ_Empty_Deletage_DataSources(despritions) - (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView {\
return [UIImage imageNamed:@"d-nodata"];\
}\
- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView {\
    NSString *title = despritions;\
    NSDictionary *attributes = @{\
                                 NSFontAttributeName:[UIFont boldSystemFontOfSize:18.0f],NSForegroundColorAttributeName:[UIColor darkGrayColor]};\
    return [[NSAttributedString alloc] initWithString:title attributes:attributes];\
}\

#define YQ_String_Url(a) [NSString stringWithFormat:@"%@%@",BaseHttpUrl,a]


#endif /* Public_h */
